<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddIndexToRepayRecords extends Migration
{
    protected $table = "repay_records";
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table($this->table, function (Blueprint $table) {
            $table->index('uid','uid');
            $table->index('summary_id','summary_id');
            $table->index('bank_cards_id','bank_cards_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        if(Schema::hasTable($this->table)){
            Schema::table($this->table, function (Blueprint $table) {
                $table->dropIndex('uid');
                $table->dropIndex('summary_id');
                $table->dropIndex('bank_cards_id');
            });
        }
    }
}
